// src/modules/user/dto/update-profile.dto.ts
import { ApiProperty } from '@nestjs/swagger';
import { IsOptional, IsString, IsEmail, Length } from 'class-validator';

export class UpdateProfileDto {
  @ApiProperty({
    description: '用户昵称',
    example: '张三',
    required: false,
  })
  @IsOptional()
  @IsString()
  @Length(2, 20)
  nickname?: string;

  @ApiProperty({
    description: '邮箱',
    example: 'zhangsan@example.com',
    required: false,
  })
  @IsOptional()
  @IsEmail({}, { message: '邮箱格式不正确' })
  email?: string;

  @ApiProperty({
    description: '手机号',
    example: '13800138000',
    required: false,
  })
  @IsOptional()
  @IsString()
  @Length(11, 11, { message: '手机号必须为11位' })
  phone?: string;

  @ApiProperty({
    description: '头像URL',
    example: 'https://example.com/avatar.jpg',
    required: false,
  })
  @IsOptional()
  @IsString()
  avatar?: string;

  @ApiProperty({
    description: '个人简介',
    example: '热爱编程的开发者',
    required: false,
  })
  @IsOptional()
  @IsString()
  @Length(0, 200)
  bio?: string;
}
